<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>

<?php
$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
/** @var \Magento\Bundle\Pricing\Render\FinalPriceBox $block */
$productId = $block->getSaleableItem()->getId();
/** @var \Magento\Bundle\Pricing\Price\FinalPrice $finalPriceModel */
$finalPriceModel = $block->getPrice();
$minimalPrice = $finalPriceModel->getMinimalPrice();
$maximalPrice = $finalPriceModel->getMaximalPrice();
/** @var \Magento\Bundle\Pricing\Price\BundleRegularPrice $regularPriceModel */
$regularPriceModel = $block->getPriceType('regular_price');
$maximalRegularPrice = $regularPriceModel->getMaximalPrice();
$minimalRegularPrice = $regularPriceModel->getMinimalPrice();
?>
<?php if ($block->getSaleableItem()->getPriceView()): ?>
    <p class="minimal-price">
        <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalPrice, [
            'display_label'     => __('As low as'),
            'price_id'          => $block->getPriceId('from-'),
            'include_container' => true
        ]); ?>
        <?php if ($minimalPrice < $minimalRegularPrice): ?>
            <span class="old-price">
                <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalRegularPrice, [
                    'display_label'     => __('Regular Price'),
                    'price_id'          => $block->getPriceId('old-price-' . $idSuffix),
                    'include_container' => true,
                    'skip_adjustments'  => true
                ]); ?>
            </span>
        <?php endif ?>
    </p>
<?php else: ?>
    <?php if ($block->showRangePrice()): ?>
        <p class="price-from">
            <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalPrice, [
                'display_label'     => __('From'),
                'price_id'          => $block->getPriceId('from-'),
                'price_type'        => 'minPrice',
                'include_container' => true
            ]); ?>
            <?php if ($minimalPrice < $minimalRegularPrice): ?>
                <span class="old-price">
                    <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalRegularPrice, [
                        'display_label'     => __('Regular Price'),
                        'price_id'          => $block->getPriceId('old-price-' . $idSuffix),
                        'include_container' => true,
                        'skip_adjustments'  => true
                    ]); ?>
                </span>
            <?php endif ?>
        </p>
        <p class="price-to">
            <?php /* @escapeNotVerified */ echo $block->renderAmount($maximalPrice, [
                'display_label'     => __('To'),
                'price_id'          => $block->getPriceId('to-'),
                'price_type'        => 'maxPrice',
                'include_container' => true
            ]); ?>
            <?php if ($maximalPrice < $maximalRegularPrice): ?>
                <span class="old-price">
                    <?php /* @escapeNotVerified */ echo $block->renderAmount($maximalRegularPrice, [
                        'display_label'     => __('Regular Price'),
                        'price_id'          => $block->getPriceId('old-price-' . $idSuffix),
                        'include_container' => true,
                        'skip_adjustments'  => true
                    ]); ?>
                </span>
            <?php endif ?>
        </p>
    <?php else: ?>
        <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalPrice, [
            'price_id'          => $block->getPriceId('product-price-'),
            'include_container' => true
        ]); ?>
        <?php if ($minimalPrice < $minimalRegularPrice): ?>
            <span class="old-price">
                <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalRegularPrice, [
                    'display_label'     => __('Regular Price'),
                    'price_id'          => $block->getPriceId('old-price-' . $idSuffix),
                    'include_container' => true,
                    'skip_adjustments'  => true
                ]); ?>
            </span>
        <?php endif ?>
    <?php endif ?>
<?php endif ?>
